package com.example.travelplan.app;

import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.content.pm.ActivityInfo;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.BaseAdapter;
import android.widget.EditText;
import android.widget.ImageButton;
import android.widget.RadioButton;
import android.widget.Spinner;
import android.widget.TextView;
import android.widget.TimePicker;

import java.util.ArrayList;
import java.util.List;

import com.example.travelplan.app.calendarDateTimeActivity;

import static android.view.View.*;
import static android.view.View.OnClickListener;
//import android.widget.ImageView;
//import android.widget.TextView;

/**
 * Created by Rodrigo on 18/06/2014.
 */
public class janelaAddAtividadeActivity extends Activity {

    public class codeLeanChapter {
        String chapterName;
        String chapterDescription;
    }

    private Spinner atividades;

    @Override
    protected void onCreate(Bundle savedInstanceState)
    {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_janelaaddatividade);
        getActionBar().hide();

        int current = getRequestedOrientation();
        // only switch the orientation if not in portrait
        if ( current != ActivityInfo.SCREEN_ORIENTATION_PORTRAIT ) {
            setRequestedOrientation( ActivityInfo.SCREEN_ORIENTATION_PORTRAIT );
        }

        adicionarAtividades();

        atividades = (Spinner) findViewById(R.id.sp_atividades);

        ImageButton bt_voltar = (ImageButton)findViewById(R.id.bt_voltar);
        final Intent intentVolta = new Intent(this, tabprincipalActivity.class);
        bt_voltar.setOnClickListener(new OnClickListener() {
            public void onClick(View v) {
                startActivity(intentVolta);
            }
        });


        //retorna o item selecionado
        //String.valueOf(atividades.getSelectedItem()));
    }

    public void adicionarAtividades()
    {
        atividades = (Spinner) findViewById(R.id.sp_atividades);
        List<String> list = new ArrayList<String>();
        list.add("Praia");
        list.add("Montanha");
        list.add("Cachoeira");
        ArrayAdapter<String> dataAdapter = new ArrayAdapter<String>(this,android.R.layout.simple_spinner_item, list);
        dataAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
        atividades.setAdapter(dataAdapter);

    }
/*
    public class CodeLearnAdapter extends BaseAdapter {

        List<codeLeanChapter> codeLeanChapterList = getDataForListView();
        @Override
        public int getCount() {
            // TODO Auto-generated method stub
            return codeLeanChapterList.size();
        }

        @Override
        public codeLeanChapter getItem(int arg0) {
            // TODO Auto-generated method stub
            return codeLeanChapterList.get(arg0);
        }

        @Override
        public long getItemId(int arg0) {
            // TODO Auto-generated method stub
            return arg0;
        }

        @Override
        public View getView(int arg0, View arg1, ViewGroup arg2) {
/*
            if(arg1==null)
            {
                LayoutInflater inflater = (LayoutInflater) tabListAtualActivity.this.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
                arg1 = inflater.inflate(R.layout.listitem_atual, arg2,false);
            }

            TextView chapterName = (TextView)arg1.findViewById(R.id.textView1);
            TextView chapterDesc = (TextView)arg1.findViewById(R.id.textView2);

            codeLeanChapter chapter = codeLeanChapterList.get(arg0);

            chapterName.setText(chapter.chapterName);
            chapterDesc.setText(chapter.chapterDescription);
*/
/*            return arg1;
        }

        public codeLeanChapter getCodeLearnChapter(int position)
        {
            return codeLeanChapterList.get(position);
        }

    }


    public List<codeLeanChapter> getDataForListView()
    {
        List<codeLeanChapter> codeLeanChaptersList = new ArrayList<codeLeanChapter>();

        for(int i=0;i<10;i++)
        {

            codeLeanChapter chapter = new codeLeanChapter();
            chapter.chapterName = "Chapter "+i;
            chapter.chapterDescription = "This is description for chapter "+i;
            codeLeanChaptersList.add(chapter);
        }

        return codeLeanChaptersList;

    }
*/
}
